package com.books.service.people.impl;

import com.books.mapper.common.PeopleMapper;
import com.books.model.entity.common.People;
import com.books.service.people.IPeopleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Date;

@Service
@Transactional
public class PeopleServiceImpl implements IPeopleService {
    @Autowired(required = false)
    private PeopleMapper peopleMapper;

    @Override
    public String findHeadUrl(String phone) {
        return peopleMapper.findHeadUrl (phone);
    }

    @Override
    public Integer findPeopleId(String phone) {
        return peopleMapper.findPeopleId (phone);
    }

    @Override
    public void change(People people, Integer id) {
        peopleMapper.updatePeople (people,id);
    }

    @Override
    public void modifyUname(String uname, String account) {
        peopleMapper.modifyUname (uname,account);
    }

    @Override
    public Date getBirthday(String phone) {
        return peopleMapper.getBirthday (phone);
    }

    @Override
    public People findByEmail(String email) {
        return peopleMapper.findByEmail(email);
    }

    @Override
    public People getPeopleByAccount(String account) {
        return peopleMapper.findByPhone(account);
    }

    @Override
    public People selectPerson(Integer people_id) {
        return peopleMapper.findByPeopleId (people_id);
    }

    @Override
    public People findByPhone(String phone) {
        return peopleMapper.findByPhone (phone);
    }

    @Override
    public int modifyPerson(People people,String phone) {
        return peopleMapper.modifyPerson (people,phone);
    }
}
